#include <algorithm>
#include <cstdio>

const int N = 1e2 + 5, bit = 31;
int n, a[N], d[bit];
long long ans;

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen("testdata.in", "r", stdin);
  freopen("testdata.out", "w", stdout);
#else
  freopen("P4301 [CQOI2013] 新Nim游戏.in", "r", stdin);
  freopen("P4301 [CQOI2013] 新Nim游戏.out", "w", stdout);
#endif
#endif

  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  std::sort(a + 1, a + n + 1,
            [](const int &lhs, const int &rhs) { return lhs > rhs; });
  for (int *i = a + 1, x = *i, *end = a + n + 1; i != end; ++i, x = *i) {
    for (int j = bit - 1; ~j; --j)
      if ((x >> j) & 1) {
        if (d[j]) x ^= d[j];
        else {
          d[j] = x;
          break;
        }
      }
    if (!x) ans += *i;
  }
  printf("%lld\n", ans);
  return 0;
}